﻿//
namespace PerceptiveMCAPI_Test
{
   public partial class get_listInterestGroups : System.Web.UI.UserControl
   {

      public ApiMethod method { get; set; }

      public bool group_name_visible
      {
         get { return liGroup.Visible; }
         set { liGroup.Visible = value; }
      }
      public bool group_update_visible
      {
         get { return liGroupUpd.Visible; }
         set { liGroupUpd.Visible = value; }
      }

      public string listId
      {
         get { return tbInterestListId.Text.Trim(); }
         set { tbInterestListId.Text = value; }
      }
      public string group_name
      {
         get { return tbListGroupName.Text.Trim(); }
         set { tbListGroupName.Text = value; }
      }
      public int grouping_id
      {
         get
         {
            int it;
            bool intval = int.TryParse( tbListGroupingId.Text.Trim(), out it );
            if ( intval )
               return it;
            else
               return -1;
         }
         set { tbListGroupingId.Text = value.ToString(); }
      }
      public string old_name
      {
         get { return tbListOldName.Text.Trim(); }
         set { tbListOldName.Text = value; }
      }
      public string new_name
      {
         get { return tbListNewName.Text.Trim(); }
         set { tbListNewName.Text = value; }
      }
      // -----------------------------------------------   
      public void Setup()
      {
         this.Visible = true;
         lblSection.Text = method.section;
         lblMethod.Text = method.name;
         //
         if ( method.name == "listInterestGroups" )
         {
            group_name_visible = false;
            group_update_visible = false;
         }
         else if ( method.name == "listInterestGroupUpdate" )
         {
            group_update_visible = true;
            group_name_visible = false;
         }
         else           // add, del
         {
            group_name_visible = true;
            group_update_visible = false;
         }
      }
   }
}